﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Data.Linq;
using System.Configuration;
using System.Windows.Forms;

namespace BLL
{
    public class DBCommands
    {
        
        public static DataContext GetConnection()
        {
            
            return new DataContext(getCon());
        }
        public static SqlConnection getCon()
        {
            Configuration config;
                config = ConfigurationManager.OpenExeConfiguration(@"LanguageApp.exe");
            return new SqlConnection(config.AppSettings.Settings["ConnectionString"].Value);
        }
     
        public static string CheckDbConnection()
        {
            try
            {
                getCon().Open();
            }
            catch (Exception e)
            {
                return e.Message;
            }
            return null;
        }
    }
}
